import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from './../views/home/index.vue'
import List from './../views/list/index.vue'
import User from './../views/user/index.vue'
import Know from './../views/know/index.vue'
import NotFound from './../views/error/NotFound.vue'
import Footer from './../components/Footer.vue'
Vue.use(VueRouter)
//定义路由规则
const routes=[
    { // 路由重定向
        path: '/',
        redirect: '/home'
      },
    {
        path:'/home',
        name:'home',
        components:{
            default : Home,
            footer : Footer
          }
    },
    {
        path:'/list',
        name:'list',
        components:{
            default  :List,
            footer : Footer
          }

    },
    {
        path:'/know',
        name:'know',
        components:{
            default : Know,
            footer : Footer
          }

    },
    {
        path:'/user',
        name:'user',
        components:{
            default : User,
            footer : Footer
          }

    },
  
    { // 404页面, 路由匹配是从上到下
        path: '**',
        name: 'notfound',
        component: NotFound
      }
]
//成成路由
const router =new VueRouter({
    mode:'hash',
    routes
})
//暴露模块
export default router